<template>
  <div class="friendsDetailWrapper">
    <div class="info">
      <img
        class="img"
        :src="require('~/assets/images/background.jpg')"
        width="200"
        height="200"
        alt="avatar"
      />
      <div class="right">
        <p class="username">CryptoCoders</p>
        <p class="address">0xd59E...B99e</p>
        <p class="copyAddress">
          <span class="address">0xd59E...B99e</span>
          <CustomCopy :copyConfig="{ copyText: '0xd59E...B99e' }" />
        </p>
        <p class="followerOrFollowing">
          <span class="number">120K</span>
          <span class="followers" @click="follow">Followers</span>
          <span class="divider"></span>
          <span class="number">120K</span>
          <span class="following" @click="following">Following</span>
          <span class="divider"></span>
          <span class="number">120K</span>
          <span class="invitated" @click="invitates">Invitates</span>
          <span class="divider"></span>
          <span class="toChat">To Chat</span>
          <span class="divider"></span>
          <span class="toChat">Follow Him</span>
        </p>
      </div>
    </div>
    <div class="content">
      <div class="left">
        <h2>Activity on chains</h2>
        <ul class="ulLeft">
          <li class="ulLi" v-for="(item, index) in 10" :key="index">
            <p class="date">{{ getDateTime(new Date()) }}</p>
            <p class="item">mint xxx nft, 去购买</p>
            <p class="item">buy xxx token, 去购买</p>
          </li>
        </ul>
      </div>
      <div class="right">
        <h2>NFTs</h2>
        <div class="nfts">
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
        </div>
        <h2>POAPs</h2>
        <div class="poaps">
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
        </div>
        <h2>TOKENs</h2>
        <div class="tokens">
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
          <div class="image"></div>
        </div>
      </div>
    </div>
    <MyFollowersAndFollowingAndInvitates :tabActive="tabActive" ref="customRef" />
  </div>
</template>

<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator'
import CustomCopy from '~/components/common/CustomCopy.vue'
import MyFollowersAndFollowingAndInvitates from '~/components/followers/index.vue'
import { FormateDate } from '@/utils/dayjs'
@Component({
  layout: 'space',
  components: {
    CustomCopy,
    MyFollowersAndFollowingAndInvitates,
  },
})
export default class FriendsDetail extends Vue {
  $refs!: {
    customRef: any
  }

  tabActive: string = ''

  getDateTime(date: Date) {
    return FormateDate.getFullYearDate(date)
  }

  follow() {
    this.tabActive = '1'
    this.$refs.customRef.dialogVisible = true
  }

  following() {
    this.tabActive = '2'
    this.$refs.customRef.dialogVisible = true
  }

  invitates() {
    this.tabActive = '3'
    this.$refs.customRef.dialogVisible = true
  }
}
</script>

<style lang="scss">
.friendsDetailWrapper {
  width: 62.5%;
  margin: 100px auto 0;
  padding: 24px;

  .info {
    display: flex;
    align-items: center;
    padding-bottom: 30px;
    border-bottom: 1px solid #515357;
    transition: all 0.5s;
    .img {
      cursor: pointer;
      border-radius: 50%;
      transform: rotate(360deg);
      animation: rotation 3s linear infinite;
    }
    @keyframes rotation {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }
    .right {
      padding-left: 40px;
      p.username {
        font-size: 36px;
        color: #fff;
      }
      p.address {
        font-size: 24px;
        color: #fff;
        padding: 10px 0;
      }
      p.copyAddress {
        margin-bottom: 10px;
        width: 140px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: #0e0f10;
        padding: 5px 10px;
        border-radius: 5px;
        span.address {
          color: #515357;
          font-size: 16px;
        }
      }
      .followerOrFollowing {
        display: flex;
        align-items: center;
        .number {
          font-size: 20px;
          color: #fff;
        }
        .followers,
        .following,
        .invitated {
          margin-left: 10px;
          cursor: pointer;
          font-size: 16px;
          color: #03e9f4;
          &:hover {
            text-decoration: underline;
          }
        }

        .divider {
          display: inline-block;
          width: 1px;
          height: 15px;
          margin: 0 20px;
          background-color: #515357;
        }

        .toChat {
          cursor: pointer;
          font-size: 16px;
          color: #03e9f4;
          &:hover {
            text-decoration: underline;
          }
        }
      }
    }
  }
  .content {
    display: flex;
    .left {
      box-sizing: border-box;
      width: calc(100% - 400px);
      padding: 30px;
      overflow: hidden;
      h2 {
        color: #fff;
      }
      ul.ulLeft {
        height: 500px;
        overflow-y: scroll;

        li.ulLi {
          .date {
            padding-top: 30px;
            color: #fff;
          }
          .item {
            padding: 10px 0;
          }
        }
      }
    }
    .right {
      padding-left: 30px;
      width: 400px;
      height: 100%;
      h2 {
        padding-bottom: 10px;
        padding-top: 30px;
        color: #fff;
      }
      .nfts {
        display: flex;
        flex-flow: row wrap;
        .image {
          margin-bottom: 5px;
          border-radius: 6px;
          border: 1px dashed #ffffff;
          height: 62px;
          width: 62px;
          margin-right: 5px;
          &:last-of-type {
            margin-right: 0;
          }
        }
      }
      .poaps {
        display: flex;
        flex-flow: row wrap;
        .image {
          margin-bottom: 5px;
          border-radius: 6px;
          border: 1px dashed #ffffff;
          height: 62px;
          width: 62px;
          margin-right: 5px;
          &:last-of-type {
            margin-right: 0;
          }
        }
      }

      .tokens {
        display: flex;
        flex-flow: row wrap;
        .image {
          margin-bottom: 5px;
          border-radius: 6px;
          border: 1px dashed #ffffff;
          height: 62px;
          width: 62px;
          margin-right: 5px;
          &:last-of-type {
            margin-right: 0;
          }
        }
      }
    }
  }
}
</style>
